﻿using System.Collections.Generic;

namespace IceCS.DesignPattern.Core.VisitorPattern.HPComputer
{
    public class Computer : IComputerComponent
    {
        private readonly List<IComputerComponent> _components;
        public Computer()
        {
            _components = new List<IComputerComponent>
            {
                new Mouse(),
                new Keyboard(),
                new Monitor()
            };
        }
        public void Accept(ComputerVisitor visitor)
        {
            _components.ForEach(c => c.Accept(visitor));
            visitor.Visit(this);
        }
    }
}
